import { nanoid } from "nanoid";
const useFetchRecord = defineStore("record", () => {
  const resData = reactive({
    msg: "success",
    data: { number: "123456" }
  });
  async function fetchData() {
    const timer = setTimeout(() => {
      clearTimeout(timer);
      resData.msg = "fail";
      resData.data.number = nanoid(6);
    }, 300);
  }
  return { resData, fetchData };
});

export const useRecordRefs = () => {
  const recordStore = useFetchRecord();
  return storeToRefs(recordStore);
};
export default useFetchRecord;
